﻿using System.ComponentModel;
using System.ServiceModel;
using System.Runtime.Serialization;
using WCFIServices.Annotations;

namespace WCFIServices
{
	[ServiceContract]
	public interface MessageBoxIService
	{
		[OperationContract(IsOneWay = true)]
		void MessageBox(MessageData messageData);

        [OperationContract(IsOneWay = true, Name = "MessageBoxWithEmployee")]
        void MessageBoxWithEmployee(Employee employee);
	}

	[DataContract]
	public class MessageData
	{
		[DataMember]
		public string Message { get; set; }

		[DataMember]
		public long PushMessageUTCTimeStamp { get; set; }
	}

    [DataContract]
    public class Employee : INotifyPropertyChanged
    {
        private string _name;
        private string _position;
        private double _yearsOfExp;

        [DataMember]
        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                this.OnPropertyChanged("Name");
            }
        }

        [DataMember]
        public string Position
        {
            get { return _position; }
            set
            {
                _position = value;
                this.OnPropertyChanged("Position");
            }
        }

         [DataMember]
        public double YearsOfExp
        {
            get { return _yearsOfExp; }
            set
            {
                _yearsOfExp = value;
                this.OnPropertyChanged("YearsOfExp");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
